<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>新增调配</title>
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/product.css">
	<link rel="stylesheet" href="css/select-big.css">
	<link rel="stylesheet" href = "css/fuzzy-query.css">
	<style>
		.content-btn {
		    margin: 0 16px;
		}
		.product-child-content{
			width: 970px;
			margin: 0 auto;
		}
		.product-child-content .content-btn {
		    margin: 0;
		}
		.content-table-two tbody tr td input{
			width: 80%;
			height: 30px;
			line-height: 30px;
			background: #F9FBFF;
			border: 1px solid #ecf2f7;
			border-radius: 15px;
			text-align: center;
		}
		.icon-delImg{
			display: inline-block;
		    background: url(images/close-1.png)no-repeat;
		    width: 25px;
		    height: 25px;
		    cursor: pointer;
		}
		.icon-delImg:hover{
			background: url(images/close-1.png)no-repeat 0 -27px;
		}
	</style>
</head>
<body>
<div class="main-content">
<form dataHref = "/expressInformation/saveChangeEexpressInformation">
	<div class="main-bg1">
		<div class="content-btn bot-line">
			<a class="icon-back" href="outTransferContract.html"></a><span class="title-info-a">新增调配</span>
		</div>
		<div class="content-list">
			<table class="content-table-newservice" cellspacing="0" cellpadding="0">
				<tbody>
					<tr>
						<td><span class="info-red"><font color="red">*</font>寄件部门：</span></td>
						<td><input name ="tractaddress" class=" required" ></td>
					</tr>
					<tr>
						<td><span class="info-red"><font color="red">*</font>收件部门：</span></td>
						<td><div class = "fuzzy-query" dataUrl = "/org/selectAllDeptTree" dataname = "departmentname" datavalue = addressee lablename = "parentName" valuename = "parentId"></div></td>
			
					</tr>
					<tr>
						<td><span class="info-red"><font color="red">*</font>快递公司：</span></td>
						<td><select class="multiselect" class=" required" name="company" id="company">
							<option value="1">顺丰快递</option>
							<option value="2">圆通快递</option>
							<option value="3">申通快递</option>
							<option value="4">韵达快递</option>
							<option value="5">汇通快递</option>
							<option value="6">邮政EMS</option>
							<option value=""7>自取</option>
						</select></td>
					</tr>
					<tr>
						<td><span class="info-red"><font color="red">*</font>快递单号：</span></td>
						<td><input name ="tracknumber" class=" required"></td>
					</tr>
					<tr>
						<td>描述：</td>
						<td><textarea name="reason" id="reason" cols="30" rows="3"></textarea></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="product-child-content">
			<div class="content-info">
				<div class="content-btn bot-line">
					<span class="title-info">纸质合同信息</span>
				</div>
				<table class="tableOrder content-table-two matop" cellspacing="0" cellpadding="0">
					<thead>	
					      <tr>         
							<td title = "项目编号" name = "projectcode" type = "string">项目编号</td>
							<td title = "项目名称" name = "projectname" type = "string">项目名称</td>
							<td title = "可调配数" name = "deNd" type = "string">可调配数</td>
							<td title = "本次调配数" name = "deNd" type = "Integer">本次调配数</td>
							<td title = "合同编号" name = "op1" type = "string">合同编号</td>
							<td title = "操作" name = "op2" type = "string">操作</td>
						  </tr>
					</thead>
						<tbody  id="setInfo">
						</tbody>						
					<!-- <tbody>
						<tr>
							<td>24355345</td>
							<td>中融国富-稳隆1号契约基金</td>
							<td>10</td>
							<td><input type="text" placeholder="1"></td>
							<td><input type="text" placeholder="1"></td>
							<td><i class="icon-delImg" onclick="del()"></i></td>
						</tr>
						<tr>
							<td>24355345</td>
							<td>中融国富-稳隆1号契约基金</td>
							<td>10</td>
							<td><input type="text" placeholder="1"></td>
							<td><input type="text" placeholder="1"></td>
							<td><i class="icon-delImg" onclick="del()"></i></td>
						</tr>
						<tr>
							<td>24355345</td>
							<td>中融国富-稳隆1号契约基金</td>
							<td>10</td>
							<td><input type="text" placeholder="1"></td>
							<td><input type="text" placeholder="1"></td>
							<td><i class="icon-delImg" onclick="del()"></i></td>
						</tr>
						<tr>
							<td>24355345</td>
							<td>中融国富-稳隆1号契约基金</td>
							<td>10</td>
							<td><input type="text" placeholder="1"></td>
							<td><input type="text" placeholder="1"></td>
							<td><i class="icon-delImg" onclick="del()"></i></td>
						</tr>
						<tr>
							<td><input type="text"></td>
							<td><input type="text"></td>
							<td>10</td>
							<td><input type="text"></td>
							<td><input type="text"></td>
							<td><i class="icon-delImg" onclick="del()"></i></td>
						</tr>
					</tbody> -->
				</table>
				<p style="line-height:40px;"><i class="btn-operation"  id="selectInfo">新增合同信息</i></p>
				<button class="save-btn matop" type="submit">保存</button>
			</div>
		</div>
	</div>
	</form>
</div>
	<script src="js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
	<script src="js/select.jquery.js"></script>
	<script type="text/javascript" src = "js/util.js"></script>
<!-- 	<script type="text/javascript" src = "js/table.js"></script> -->
	<script type="text/javascript" src = "js/fuzzy-query.js"></script>
	<script src="js/jquery-validation/1.11.0/jquery.validate.min.js" type="text/javascript"></script>
	<script type="text/javascript" src = "js/submit.js"></script>
	<script type="text/javascript" src = "js/validate.js"></script>
    <script type="text/javascript">
		$('.multiselect').multiselect({setMaxOptionNum:4,selectedHtmlValue:'全部',setWidth: 338+'px'});
		$('#single1').multiselect({multiple:false,selectedHtmlValue:'部门名称1',setWidth: 338+'px'});
		$('#single2').multiselect({multiple:false,selectedHtmlValue:'部门名称2',setWidth: 338+'px'});
		$('#company').multiselect({multiple:false,selectedHtmlValue:'顺丰快递',setWidth: 338+'px'});
		$('#single4').multiselect({multiple:false,selectedHtmlValue:'2343543545645654',setWidth: 338+'px'});
     $(document).ready(function(){
    	/*  $('#save').click(function(){
    		
    		 var data = {}; 
    		    data.tractaddress =$('input[ name ="tractaddress"]').val();
        		data.addressee = $('.fuzzy-query').find('select').val();
        		data.company = $('#company').val();
        		data.tracknumber = $('input[ name ="tracknumber"]').val();  
        		data.reason = $('#reason').val();       	
        		var inbounds = [];
        		$('#setInfo').find('tr').each(function(){
        			var contractInbound = {};
        			 contractInbound.projectcode = $(this).find('td').eq(0).text();
        			 contractInbound.projectname = $(this).find('td').eq(1).text();
        			 contractInbound.total =  $(this).find('td').eq(3).children('input').val();
        			 contractInbound.contractpagecode =  $(this).find('td').eq(4).children('input').val();
        			 inbounds.push(contractInbound);
        		})
        		if(inbounds.length ==0){
        			layer.msg("调配数据不能为空！",{
        			    offset:'60%'
        			});	
        			return false;
        		}
        		data.inbounds = inbounds;
        		console.log(data); */
    	/* 	 AjaxDate('expressInformation/saveChangeEexpressInformation',data); */
    	 $('#selectInfo').click(function(){
    		/*  parent.setData($("table").getAllData()[i]); */
			  parent.layer.open({
		      type: 2,
		      title: '选择',
		      shadeClose: true,
		      shade: 0.2,
		      maxmin: true, //开启最大化最小化按钮
		      area: ['800px', '550px'],
		      content: 'selectredeployment.html',
		      end:function(){
					var  data = parent.getData();
					if(data){
						  data.forEach(function(value,i){
						    	$('#setInfo').append('<tr>'+
									'<td><input type = "hidden" name = "inbounds[' + i + '].projectcode" value = "' + value.projectcode + '" > '+value.projectcode+'</td>'+
									'<td><input type = "hidden" name = "inbounds[' + i + '].projectname" value = "' + value.projectname + '" > '+value.projectname+'</td>'+
									'<td><input type = "hidden" name = "inbounds[' + i + '].department" value = "' + value.department + '" > <input type = "hidden" name = "inbounds[' + i + '].deNd" value = "' + value.deNd + '" > '+value.deNd+'</td>'+
									'<td><input type="text" name = "inbounds[' + i + '].total" value="'+value.deNd+'"></td>'+
									'<td><input type="text" name = "inbounds[' + i + '].contractpagecode"></td>'+
									'<td><i class="icon-delImg" onclick="del(this)"></i></td>'+
								'</tr>'); 
						   })
						}
					}			 
	        	});
    	 })
     })
		function getHeight(){
			var myiframeH=$(".main-content").height();
			var _parent=$(window.parent.document);
        	_parent.find('body').css('height',(myiframeH+150)+'px');
			_parent.find('.main-position').css('height',(myiframeH+100)+'px');
    	};

    	$('.main-content').resize(function(){
			getHeight();
		});
    	function tableCallBack(my){
		
		}
    	function del(my){
    		my = $(my);
    		my.parent().parent().remove();
    	}
    	function validateCallback(){
    		var inbounds = [];
    		$('#setInfo').find('tr').each(function(){
    			var contractInbound = {};
    			 contractInbound.projectcode = $(this).find('td').eq(0).text();
    			 contractInbound.projectname = $(this).find('td').eq(1).text();
    			 contractInbound.total =  $(this).find('td').eq(3).children('input').val();
    			 contractInbound.contractpagecode =  $(this).find('td').eq(4).children('input').val();
    			 inbounds.push(contractInbound);
    		})
    		if(inbounds.length ==0){
    			layer.msg("调配数据不能为空！",{
    			    offset:'60%'
    			});	
    			return false;
    		}
    		return true;
    	} 
    	function submitCallback(date){
    		parent.layer.msg("'调配成功！",{
			    offset:'20%'
			});	
    		parent.goUrl("outTransferContract.html");
        }
	</script>
</body>
</html>